export function formatDate (timestamp) {
    if(timestamp) {
        var now = new Date(timestamp);
        // var year = now.getFullYear();

        // var month = now.getMonth() + 1;
        // month = fixZero(month);

        var day = now.getDate();
        day = fixZero(day);

        var hour = now.getHours();
        hour = fixZero(hour);

        var minute = '' + now.getMinutes();
        minute = fixZero(minute);

        // var second = now.getSeconds();
        // second = fixZero(second);

        if (!hour) return day+'日';
        if (hour) return day + "日" + hour + ":"+minute;
        return day +"日" + hour + ":"+minute;
    }
    return "";
};

function fixZero(p) {
    var str = '' + p;
    if (str.length == 1) {
        str = '0' + str;
    }
    return str;
}
